export const isObject = (obj) => Object.prototype.toString.call(obj) === "[object Object]"
export const deepMerge = (target, source) => {
	if (isObject(target) && isObject(source)) {
  	// 遍历源对象，将源对象存在但目标对象不存在的属性赋值给目标对象
		for (const key in source) {
			if (!target.hasOwnProperty(key)) {
				target[key] = source[key]
			}
		}
		// 遍历目标对象
		for (const key in target) {
			if (source.hasOwnProperty(key)) {
      	// 判断属性值数据类型，若不是对象类型则赋值给目标对象
				if (!isObject(source[key])) {
					target[key] = source[key]
				} else {
					// 是对象类型则递归调用
					deepMerge(target[key], source[key])
				}
			}
		}
	}
}
